const { openJson, saveJson } = require('../utils/fileSystem');

const SCHEDULE_PATH = [__dirname, '..', 'data', 'schedule.json'],
      COMMANDS_PATH = [__dirname, '..', 'data', 'commands.json'];

const dataService = {
    schedule: {
        load: () => openJson(...SCHEDULE_PATH),

        save: (schedule) => saveJson(schedule, ...SCHEDULE_PATH)
    },

    commands: {
        load: () => openJson(...COMMANDS_PATH)
    }
};

module.exports = dataService;
